﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Web7.Ioc;

namespace Web7.Domain
{
    public interface IDomainService<T> : IDomainService<T, Guid> where T : Entity
    {
    }

    public interface IDomainService<T, TId> : IDependency where T : Entity<TId>
    {
        void Create(T entity);
        void Update(T entity);
        void Delete(T entity);
        void Delete(IEnumerable<T> entities);
        void Delete(params TId[] ids);
        void Delete(Expression<Func<T, bool>> predicate);

        T Get(TId id);
        T Get(Expression<Func<T, bool>> predicate);
 
        int Count(Expression<Func<T, bool>> predicate);
        IEnumerable<T> Fetch(Expression<Func<T, bool>> predicate);
        IEnumerable<T> Fetch(Expression<Func<T, bool>> predicate, Action<Orderable<T>> order);
        IEnumerable<T> Fetch(Expression<Func<T, bool>> predicate, Action<Orderable<T>> order, int skip, int count);
    }

 
}
